package com.link.base.task;

import com.link.base.core.basic.config.xxljob.BaseLinkJobHandler;

import com.link.base.microinterface.microservice.CdcCrowdClient;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 发送kafka消息更新人群包里的人群明细数据定时任务
 *
 * @author KuangRuifeng
 * @date 2019/10/12 13:40
 */
@JobHandler(value = "sendCrowdKafkaInfo")
@Component
public class TaskSendCrowdKafkaInfo extends BaseLinkJobHandler {
    @Resource
    private CdcCrowdClient cdcCrowdClient;

    @Override
    public ReturnT<String> execute(String params) throws Exception {
        XxlJobLogger.log("XXL-JOB, Start.");
        super.setLogin(params);
        try {
            cdcCrowdClient.sendCrowdKafkaInfo();
        } catch (Exception e) {
            XxlJobLogger.log(e.getMessage());
            return ReturnT.FAIL;
        }
        return ReturnT.SUCCESS;
    }
}
